<template>
  <div class="total-container">
    <div class="top-container">
      <div class="item-box" v-for="item in topData" :key="item.name">
        <img class="icon" :src="item.iconPath" alt="" />
        <div class="right-container">
          <div class="title">{{ item.fl }}</div>
          <div class="bottom-value">
            <div class="num">
              <countTo :startVal="0" :endVal="+item.sl" :duration="1200" separator=""></countTo>
            </div>
            <div class="unit">{{ item.unit }}</div>
            <img class="arrow" src="../../../img/right-row1-icon3.png" alt="" />
            <div class="rate">{{ item.tb }}%</div>
          </div>
        </div>
      </div>
    </div>
    <div class="bottom-container">
      <el-carousel indicator-position="outside">
        <el-carousel-item v-for="item in bottomData" :key="item.id">
          <img class="carousel-image" :src="item.imgPath" alt="" />
          <div class="img-title">{{ item.name }}</div>
        </el-carousel-item>
      </el-carousel>
    </div>
  </div>
</template>
<script>
import icon1 from '../../../img/right-row2-icon2.png'
import icon2 from '../../../img/right-row2-icon3.png'
import img1 from '../../../img/right-row2-img1.png'
import countTo from 'vue-count-to'
import { lyjt } from '@/api/dongyingData'
export default {
  data() {
    return {
      topData: null,
      icon1,
      icon2,
      bottomData: [
        {
          name: '东营植物园',
          imgPath: img1
        },
        {
          name: '东营植物园',
          imgPath: img1
        },
        {
          name: '东营植物园',
          imgPath: img1
        }
      ]
    }
  },
  components: {
    countTo
  },
  mounted() {
    this.getData()
  },
  methods: {
    async getData() {
      const res = await lyjt.lygk()
      this.topData = res.result
      this.topData[0].iconPath = icon1
      this.topData[1].iconPath = icon2
      this.topData[0].unit = '亿人次'
      this.topData[1].unit = '亿元'
    }
  }
}
</script>
<style lang="scss" scoped>
.total-container {
  .top-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    .item-box {
      height: 48px;
      width: 50%;
      display: flex;
      justify-content: center;
      align-items: center;
      .icon {
        height: 48px;
        width: 51px;
      }
      .right-container {
        height: 100%;
        .title {
          height: 16px;
          background: url('../../../img/right-row2-icon1.png') no-repeat left
            bottom;
          background-size: 93px 12px;
          font-family: MicrosoftYaHeiUI;
          font-size: 16px;
          color: #ffffff;
          line-height: 16px;
          text-align: left;
          font-style: normal;
          text-transform: none;
          padding-left: 10px;
        }
        .bottom-value {
          display: flex;
          justify-content: start;
          align-items: baseline;
          margin-top: 6px;
          padding-left: 10px;
          .num {
            font-family: MicrosoftYaHeiUI, MicrosoftYaHeiUI;
            font-weight: bold;
            font-size: 20px;
            color: #ffde00;
            line-height: 30px;
            text-align: left;
            font-style: normal;
            text-transform: none;
          }
          .unit {
            margin-left: 3px;
            font-family: MicrosoftYaHeiUI;
            font-size: 14px;
            color: #ffffff;
            line-height: 0px;
            text-align: left;
            font-style: normal;
            text-transform: none;
          }
          .arrow {
            width: 10px;
            height: 14px;
            margin-left: 10px;
          }
          .rate {
            font-family: MicrosoftYaHeiUI;
            font-size: 14px;
            font-weight: bold;
            color: #ff3e3e;
            line-height: 14px;
            text-align: right;
            font-style: normal;
            text-transform: none;
          }
        }
      }
    }
  }
  .bottom-container {
    height: 150px;
    .img-title {
      position: absolute;
      bottom: 0;
      left: 14px;
      height: 31px;
      width: 395px;
      background: url('../../../img/right-row2-icon4.png') no-repeat center
        center;
      display: flex;
      justify-content: center;
      align-items: center;
      font-family: MicrosoftYaHeiUI;
      font-size: 16px;
      color: #ffffff;
      line-height: 16px;
      text-align: center;
      font-style: normal;
      text-transform: none;
      z-index: 2;
    }
    ::v-deep .el-carousel {
      height: 100%;
      width: 100%;
      .el-carousel__container {
        height: 100%;
        width: 100%;
        border-radius: 6px 6px 6px 6px;
        border: 2px solid #018dfa;
      }
      .el-carousel__indicator {
        display: none;
      }
      .carousel-image {
        height: 100%;
        width: 100%;
        z-index: 1;
        border-radius: 6px 6px 6px 6px;
      }
    }
  }
}
</style>
